using Aurora.TaskScheduler.Abstractions.Message;

namespace Aurora.TaskScheduler.Extension;

/// <summary>
/// 任务处理
/// </summary>
public interface ITaskHandler
{
    /// <summary>
    /// 开启任务
    /// </summary>
    /// <param name="task"></param>
    /// <returns></returns>
    Task<bool> Start(AppTask task);


    /// <summary>
    /// 立即执行一次作业
    /// </summary>
    /// <param name="task"></param>
    /// <returns></returns>
    Task<bool> Run(AppTask task);


    /// <summary>
    /// 添加任务
    /// </summary>
    /// <param name="task"></param>
    /// <returns></returns>
    Task<string> Add(AppTask task);

    /// <summary>
    /// 更新任务
    /// </summary>
    /// <param name="task"></param>
    /// <returns></returns>
    Task<bool> Update(AppTask task);

    /// <summary>
    /// 移除任务
    /// </summary>
    /// <param name="task"></param>
    /// <returns></returns>
    Task<bool> Remove(AppTask task);

    /// <summary>
    /// 暂停任务
    /// </summary>
    /// <param name="task"></param>
    /// <returns></returns>
    Task<bool> Pause(AppTask task);

    /// <summary>
    /// 添加任务-不自动启动
    /// </summary>
    /// <param name="task"></param>
    /// <returns></returns>
    Task<bool> AddJobNoStart(AppTask task);

    /// <summary>
    /// 添加任务-不自动启动
    /// </summary>
    /// <param name="task"></param>
    /// <returns></returns>
    Task<bool> AddJobNoStart(List<AppTask> tasks);
    /// <summary>
    /// 加载定时任务
    /// </summary>
    /// <returns></returns>
    Task InitJobs();


    // /// <summary>
    // /// 获取程序内的 class dll
    // /// </summary>
    // /// <returns></returns>
    // Task<List<string>> GetClassJobDll();


    Task<List<AppTask>> GetJobs(bool containerOne = false);
}